def c(s):
    stack = []
    o = ['(', '[', '{', '<']
    c = [')', ']', '}', '>']
    
    for b in s:
        if b in o:
            stack.append(b)
        elif b in c:
            if len(stack) == 0:
                return False
            if o.index(stack[-1]) == c.index(b):
                stack.pop()
            else:
                return False
    
    return len(stack) == 0

s = input("Введите скобочную последовательность: ")
r = c(s)
print(r)
